//
//  CalloutInfoCell.m
//  CarLifes
//
//  Created by yu on 2017/6/28.
//  Copyright © 2017年 jpas. All rights reserved.
//

#import "CalloutInfoCell.h"

@implementation CalloutInfoCell

- (void)awakeFromNib {
    [super awakeFromNib];
    UIView *lineView = [[UIView alloc] init];
    //lineView.backgroundColor = kBackGroundLightGrayColor;
    [self.contentView addSubview:lineView];
    
    if (@available(iOS 13.0, *)) {
        //lineView.backgroundColor = UIColor.opaqueSeparatorColor;
        UIColor *textColor = [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull traitCollection) {
            if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleLight) {
                return kTextBlackColor;
            } else {
                return kDarkTextColor;
            }
        }];
        self.titleLabel.textColor = textColor;
        self.contentLabel.textColor = textColor;
        
        UIColor *lineColor = [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull traitCollection) {
            if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleLight) {
                return kBackGroundLightGrayColor;
            } else {
                return UIColor.opaqueSeparatorColor;
            }
        }];
        lineView.backgroundColor = lineColor;
    } else {
        self.titleLabel.textColor = kTextBlackColor;
        self.contentLabel.textColor = kTextBlackColor;
        lineView.backgroundColor = kBackGroundLightGrayColor;
    }
    
    lineView.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .rightSpaceToView(self.contentView, 10)
    .bottomEqualToView(self.contentView)
    .heightIs(1);
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
